﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using Baosight.Platform.Core.UI.Controls;
using Baosight.Platform.Core;
using Baosight.ZNH.ZMCommon;
using Baosight.ZNH.ZMCommon.ChildWindows;
using Telerik.Windows.Controls;
using System.Collections.ObjectModel;
using System.Windows.Browser;
using System.Text;
using System.Windows.Controls;
using Telerik.Windows.Controls.GridView;


namespace Baosight.ZNH.ZMCT.UI
{
    public partial class ZMCT31 : EFViewCmes
    {
        public ZMCT31()
        {
            InitializeComponent();
            base.BeforeAction += OnBeforeAction;
        }
        /// <summary>
        /// 新增/修改前设置属性
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnBeforeAction(object sender, EventArgs e)
        {
            EFViewCmesProperty _view = new EFViewCmesProperty();
            _view.EFGridCheckedRows = this.grid.GetCheckedEIRows();
            base.ViewProperty = _view;
        }

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="initData"></param>
        public override void Initialize(Platform.Core.EIInfo initData)
        {
            initData.AddBlock(this.getSuccOrFail("cmes.ct.succorfail", false));
            base.Initialize(initData);
        }
        /// <summary>
        /// 是否选择
        /// </summary>
        /// <returns></returns>
        public EIBlock getSuccOrFail(string blockName, bool isAll)
        {
            EIBlock block = new EIBlock(blockName);

            EIColumn eiColumn = new EIColumn();
            eiColumn.Name = "display";
            eiColumn.TypeLabel = "C";
            block.AddColumn(eiColumn);

            eiColumn = new EIColumn();
            eiColumn.Name = "value";
            eiColumn.SetTypeLabel("C");
            block.AddColumn(eiColumn);

            IList<EIRow> _list = new List<EIRow>();
            EIRow _map = null;

            if (isAll)
            {
                _map = new EIRow();
                _map.Add("value", "");
                _map.Add("display", "");
                _list.Add(_map);
            }

            _map = new EIRow();
            _map.Add("value", "成功");
            _map.Add("display", "成功");
            _list.Add(_map);

            _map = new EIRow();
            _map.Add("value", "失败");
            _map.Add("display", "失败");
            _list.Add(_map);

            block.AddRows(_list);
            return block;
        }
    }
}
